//createApp函数,创建应用函数
import { createApp } from 'vue'

//仓库:采用pinia仓库并非vuex
import pinia from './stores'

//引入element-plus插件,全部引入
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
console.log(import.meta.env.VITE_API_URL)
//引入根组件
import App from './App.vue'

//路由器:配置路由
import router from './router'

//引入scss样式,scss与less样式一样的差不多
//less->@  scss->$
import './styles/index.scss'

import ElSvg from './components/SvgIcon/ElSvg'
const app = createApp(App);
//ELSvg它是一个函数:调用，传递app应用对象
//将element-plus里面图标变为全局组件
ElSvg(app);

//商品一级、二级、三级分类的全局组件
import Category from '@/components/Category/index.vue';
app.component('Category',Category);



//创建全局的自定义指令
//app.component
//app.directive
//app.filter

//定义全局的自定义指令
//第一个参数:自定义指令的名字  v-has
//第二个参数:配置对象

import has from '@/utils/has';
has(app);
//全局路由守卫的判断
import './permission'
import { hasChanged } from '@vue/shared'
import "@/mock"

//vue-echarts的使用
import * as echarts from 'echarts';
import vchart from 'vue-echarts';
app.component('v-chart',vchart);





app.use(pinia)
  .use(router)
  .use(ElementPlus, {
    locale: zhCn,
  })
  .mount('#app')
